﻿@model projectManagementWeb.Models.ProjectLeader.ProjectLeadTaskListModel
           
@{
    ViewBag.Title = "ProjectTasksForm";
}

    <p align="right">
        @Html.ActionLink("<< Regresar", "Index")
    </p>

<style type="text/css">
.ui-datepicker { width: 17em; padding: .2em .2em 0; background: #66FF99;}
</style>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".date").datepicker
            ({
                dateFormat: 'mm/dd/yy',
                showStatus: true,
                showWeeks: true,
                highlightWeek: true,
                numberOfMonths: 1,
                showAnim: "scale",
                showOptions: {
                    origin: ["top", "left"]
                }
            });
    });
</script>

<fieldset>

    <legend>Bienvenido</legend>
    <h1>@User.Identity.Name</h1>

    @{
        
        projectManagementWeb.Controllers.DeveloperController controlLayer = new projectManagementWeb.Controllers.DeveloperController();
        projectManagementWeb.Models.Developer.UserDataModel userData = controlLayer.GetUserData(@User.Identity.Name);
    <h2>@userData.UserCompleteName</h2>
    <h2>@userData.UserMail</h2>
        projectManagementWeb.Controllers.ProjectLeaderController plControlLayer = new projectManagementWeb.Controllers.ProjectLeaderController();    
    <h2>Proyecto: @plControlLayer.GetUserProject(User.Identity.Name)</h2>
        
    
   }



</fieldset>

<fieldset>

   

@using (Html.BeginForm("ProjectTasksForm", "ProjectLeader", FormMethod.Post))
{
    @Html.ValidationSummary(true, "Han ocurrido errores")@Html.ValidationMessageFor(m => m.TaskList)
     <legend>Lista de Tareas</legend>
    <p>
       <input type="submit" value="Guardar Cambios"/>
        @Html.ActionLink("Agregar una nueva tarea...", "CreateTask")
    </p>
    
    <table>

        <tr>
            <td>
                Eliminar Tarea
            </td>
            <td>
                ID
            </td>
            <td>
                Tarea
            </td>
            <td>
                Inicio
            </td>
            <td>
                Final
            </td>
            <td>
                Valor Planeado
            </td>
            <td>
                Esfuerzo Invertido
            </td>
            <td>
                Esfuerzo Faltante
            </td>
            <td>
                Estatus
            </td>
            <td>
                Recurso
            </td>
            <td>
                Módulo
            </td>
        </tr>
       @if (Model.TaskList != null)
       {
           for (int i = 0; i < Model.TaskList.Count; i++)
           {
           @Html.HiddenFor(model => model.TaskList[i].TaskDescription);
            @*Html.HiddenFor(model => model.TaskList[i].StartDate);
            @Html.HiddenFor(model => model.TaskList[i].EndDate);*@
            @Html.HiddenFor(model => model.TaskList[i].TaskName);
            @Html.HiddenFor(model => model.TaskList[i].ProjectID);
            @Html.HiddenFor(m => m.ProjectLeaderID);
        <tr>
        <td>
         @Html.CheckBoxFor(model => model.TaskList[i].IsSelected) @Html.ValidationMessageFor(m => m.TaskList[i].IsSelected)
        </td>
         <td> 
           @Html.TextBoxFor(model => model.TaskList[i].TaskID, new { @readonly = "readonly", style = "width:50px;" })  
           @*@Html.ValidationMessageFor(m => m.TaskList[i].TaskID )*@
           
          </td>
         <td>
           @Html.ActionLink(Model.TaskList[i].TaskName, "TaskDescription", new { taskID = Model.TaskList[i].TaskID }, null)
         </td>
         <td>
         <div class="editor-field">
          @*Html.TextBox("StartDate", Model.TaskList[i].StartDate.ToString("dd/mm/yyyy"), new { @class = "date", style = "width:100px;" })
          @Html.ValidationMessageFor(model => model.TaskList[i].StartDate)*@
          @Html.TextBoxFor(model => model.TaskList[i].StartDate, new { @class = "date", style = "width:100px;" })
         </div>
         </td>
         <td>
         @*Html.TextBox("EndDate", Model.TaskList[i].EndDate, new { @class = "date", style = "width:100px;" })
          @Html.ValidationMessageFor(model => model.TaskList[i].EndDate)*@

          @Html.TextBoxFor(model => model.TaskList[i].EndDate, new { @class = "date", style = "width:100px;" })
         </td>
         <td>
           @Html.TextBoxFor(model => model.TaskList[i].PlannedEstimate, new { style = "width:50px;" })
         @Html.ValidationMessageFor(model => model.TaskList[i].PlannedEstimate)
         </td>
         <td>
           @Html.TextBoxFor(model => model.TaskList[i].CurrentEffortDone, new { style = "width:50px;" })
         @Html.ValidationMessageFor(model => model.TaskList[i].CurrentEffortDone)
         </td>
         <td>
          @Html.TextBoxFor(model => model.TaskList[i].CurrentEffortPending, new { style = "width:50px;" })
         @Html.ValidationMessageFor(model => model.TaskList[i].CurrentEffortPending)
         </td>
         <td>
          @{
                                                   var selectList = new SelectList(Model.StatusList, "Value", "Text", Model.TaskList[i].CurrentStatus);
        }
        @Html.DropDownListFor(model => model.TaskList[i].CurrentStatus, selectList)
         </td>
          <td>
           @{
                                                   var userselectList = new SelectList(Model.UserList, "Value", "Text", Model.TaskList[i].ResourceID);
        }
        @Html.DropDownListFor(model => model.TaskList[i].ResourceID, userselectList)
         </td>
         <td>
           @{
                                                   var moduleselectList = new SelectList(Model.ModuleList, "Value", "Text", Model.TaskList[i].ModuleID);
        }
        @Html.DropDownListFor(model => model.TaskList[i].ModuleID, moduleselectList)
         </td>
        </tr>
           }
       }
         
    </table>


}
</fieldset>